#!/bin/bash

langs="slovene arabic turkish danish dutch portuguese german czech"

maxsize=1500
missing="yes"
while [ $missing = "yes" ] ; do
        missing="no"
        for lang in `echo $langs` ; do
                # Check whether experiment is still missing
                if ! ls experiments/results/test-$lang-*all*.log 2> /dev/null ; then
                        # Try to find greedy-final result for language
                        missing="yes"
                        genes=`grep 'greedy-final' experiments/results/greedy-genes-${lang}-*.log 2>/dev/null | tail -1 | sed -e 's/^.*greedy-final: //g' | awk '{print $1}'`
                        echo "genes=$genes"
                        if [ ! -z "$genes" ] ; then
                                echo "Running ip10-all experiment for $lang"
                                echo sh experiments/exp-ip10-all $lang $maxsize -test -eval.traincorpus=false -genes=$genes
                                sh experiments/exp-ip10-all $lang $maxsize -test -eval.traincorpus=false -genes=$genes
                        fi
                fi
        done
        sleep 150
done

